package com.example.materialtest

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import android.widget.EditText
import android.widget.Toast

class RegisterActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_register)
        val name=findViewById<EditText>(R.id.input_name)
        val button_l=findViewById<Button>(R.id.button_l)
        val button_r=findViewById<Button>(R.id.button_r)
        button_l.setOnClickListener {
            val intent = Intent(this, enter::class.java)
            startActivity(intent)
            finish()
        }
        button_r.setOnClickListener {
            if(!name.text.toString().equals("")){
                val intent = Intent(this, MainActivity::class.java)
                startActivity(intent)
                finish()
            }else{
                Toast.makeText(this,"昵称不能为空", Toast.LENGTH_SHORT).show()
            }
        }
    }
}